﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Ajax DEMO - ClownFish.Web - http://www.cnblogs.com/fish-li</title>
    <script type="text/javascript" src="/static/js/jquery/jquery-1.4.4.min.js"></script>
    <style type="text/css">
        * {
            font-family: Consolas, '微软雅黑', '宋体';
            font-size: 14px;
        }
    </style>
</head>
<body>

<fieldset>
	<legend>/Ajax/Fish.AA.Test/Add.aspx</legend>
	<input type="text" id="txtA1" style="width: 50px" value="3" /> +
	<input type="text" id="txtB1" style="width: 50px" value="2" /> =
	<span id="spanResult1"></span>
	<input type="button" id="btnAdd1" value="Add" />
</fieldset>

<p></p>

<fieldset>
	<legend>/Ajax/Fish.BB.Test/Add.aspx</legend>
	<input type="text" id="txtA2" style="width: 50px" value="3" /> +
	<input type="text" id="txtB2" style="width: 50px" value="2" /> =
	<span id="spanResult2"></span>
	<input type="button" id="btnAdd2" value="Add" />
</fieldset>


<fieldset>
    <legend>/Ajax/DEMO.Controllers.TestTask.TaskDemoService/Add.aspx  （Task AJAX DEMO）</legend>
    <input type="text" id="txtA3" style="width: 50px" value="3" /> +
    <input type="text" id="txtB3" style="width: 50px" value="2" /> =
    <span id="spanResult3"></span>
    <input type="button" id="btnAdd3" value="Add" />
</fieldset>

<fieldset>
    <legend>/api/ns/Demo1/Add.aspx  （命名空间别名方式）</legend>
    <input type="text" id="txtA4" style="width: 50px" value="3" /> +
    <input type="text" id="txtB4" style="width: 50px" value="2" /> =
    <span id="spanResult4"></span>
    <input type="button" id="btnAdd4" value="Add" />
</fieldset>

<script type="text/javascript">

$(function(){
	$("#btnAdd1").click(function(){
		$.ajax({
			//url: "/Ajax/Fish.AA/Test/Add.aspx", // 这个URL只能在IIS的集成模式下才有效。
			url: "/Ajax/Fish.AA.Test/Add.aspx",
			data: {a: $("#txtA1").val(), b: $("#txtB1").val()},
			success: function(responseText){
				$("#spanResult1").text(responseText);
			}
		});
	});
	
	$("#btnAdd2").click(function(){
		$.ajax({
		    url: "/Ajax/Fish.BB.Test/Add.aspx",
			data: {a: $("#txtA2").val(), b: $("#txtB2").val()},
			success: function(responseText){
				$("#spanResult2").text(responseText);
			}
		});
	});



	$("#btnAdd3").click(function () {
	    $.ajax({
	        url: "/Ajax/DEMO.Controllers.TestTask.TaskDemoService/Add.aspx",
	        data: { a: $("#txtA3").val(), b: $("#txtB3").val() },
	        success: function (responseText) {
	            $("#spanResult3").text(responseText);
	        }
	    });
	});


	$("#btnAdd4").click(function () {
	    $.ajax({
	        url: "/api/ns/Demo1/Add.aspx",
	        data: { a: $("#txtA4").val(), b: $("#txtB4").val() },
	        success: function (responseText) {
	            $("#spanResult4").text(responseText);
	        }
	    });
	});

});


</script>


    <fieldset>
        <legend>AJAX 计算MD5</legend>
        <p>
            请输入要计算的字符串：
            <input type="text" id="txtInput" style="width: 200px" value="Fish Li" />
            <input type="button" id="btnGetMd5" value="计算MD5" />
        </p>
        <p>计算结果：<b><span id="spanReslt"></span></b></p>
    </fieldset>
    

    <script type="text/javascript">

        $(function () {
            $("#btnGetMd5").click(function () {
                $.ajax({
                    url: "/api/ns/Demo1/GetMd5.aspx",
                    data: { input: $("#txtInput").val() },
                    success: function (responseText) {
                        $("#spanReslt").text(responseText);
                    }
                });
            });


        });

    </script>


</body>
</html>
